﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using HRProject.Code.Common;
using HRProject.Code.DAO;

namespace HRProject.Component
{
    public partial class AccountInfo : System.Web.UI.UserControl
    {
        private string editUserId;

        public string EditUserId
        {
            get { return editUserId; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            LblLogInAs.Text = ContentProvider.GetString("LogInAs");
            LoginStatus1.LogoutText = ContentProvider.GetString("LogOut");
            LblTasks.Text = ContentProvider.GetString("Work");
            MembershipUser user = Membership.GetUser();
            if (user != null)
            {
                hplUsername.Text = user.UserName;
                editUserId = user.ProviderUserKey.ToString();
                hplUsername.NavigateUrl = "/User/EditUserInfo.aspx?editUserId=" + editUserId;

                TaskDAO taskDAO = new TaskDAO();
                int count = taskDAO.countUnfinishedTasks((Guid)user.ProviderUserKey);
                HplNumberOfTasks.Text = "(" +Convert.ToString(count)+")";
            }
        }
    }
}